package UIComponents
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	/** 
	 * @author thy
	 * @version 1.0.0 
	 * 创建时间：Apr 24, 2012 10:40:37 AM 
	 */ 
	public class NewVipQQ extends Sprite
	{
		private var closeBtn:DisplayObject;
		private var kthzBtn:DisplayObject;
		private var xhhzbtn:DisplayObject;
		private var lqBtn:DisplayObject;
		
		private var newTip:TextField;
		
		public function NewVipQQ()
		{
			init();
		}
		
		private function init():void
		{
			closeBtn=this.getChildByName("closeBtn");
			kthzBtn=this.getChildByName("kthzBtn");
			xhhzbtn=this.getChildByName("xfhzBtn");
			lqBtn=this.getChildByName("lqBtn");
			
			
			newTip=this.getChildByName("newTips") as TextField;
			
			this.closeBtn.addEventListener(MouseEvent.CLICK,onClick);
			this.xhhzbtn.addEventListener(MouseEvent.CLICK,hzFun);
			this.kthzBtn.addEventListener(MouseEvent.CLICK,hzFun);
			this.lqBtn.addEventListener(MouseEvent.CLICK,lqFun);
		}
		
		private function onClick(e:MouseEvent):void
		{
			this.dispatchEvent(new PanelEvent(PanelEvent.CLOSE,true));
		}
		private function lqFun(e:MouseEvent):void
		{
			this.dispatchEvent(new PanelEvent(PanelEvent.CUSTOMCALLBACK,true));
		}
		
		private function hzFun(e:MouseEvent):void
		{
			this.dispatchEvent(new PanelEvent(PanelEvent.OPENNEWQQVIP,true));
		}
		
		/**
		 * 控制黄钻显示按钮，跟领取按钮 
		 * @param isKt
		 * @param isLq
		 */		
		public function contorlHzBtn(isKt:Boolean):void
		{
			this.kthzBtn.visible=isKt;
			this.xhhzbtn.visible=!isKt;
			if(!isKt)
			{
//				this.mouseEnabled=true;
				this.lqBtn.visible=true
				this.newTip.text="您是黄钻用户，可以领取礼包。";
			}else{
				this.lqBtn.visible=false;
				this.newTip.text="您不是黄钻用户，开通后领取。";
			}
		}
		
		
		public function setInfo(arr:Array):void
		{
			for(var i:int=0;i<arr.length;i++)
			{
				var obj:Object=arr[i];
				var dis:DisplayObject=null;
				var des:String="";
				if(obj)
				{
					dis=obj.icon;
					dis.width=65;
					dis.height=65;
					des=dis["displayViewIconName"];
				}
				(this.getChildByName("item"+(i+1)) as IconContainer).addPic(dis,des);
				(this.getChildByName("itemNum"+(i+1)) as TextField).text="X"+obj.itemNum;
				(this.getChildByName("itemNum"+(i+1)) as TextField).selectable=false;
			}
		}
		
	}
}
